<?php
if (!defined('TIMESTARTPAGE')) 
{
    define('TIMESTARTPAGE', microtime(true));
}
if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) 
{
    @ob_start("ob_gzhandler");
}
$_GET['AjaxFrame']   = true;
//load config
@include "../includes/config/config.php";
//create object db
include "../includes/class_mysql.php";
include "../includes/gpc_function.php";
include "includes/functions.php" ;
include "language/language.php";
include "includes/global.php";
@require "includes/permission.php";


//check module exists
if (!empty($module) && is_dir("source/" . $module) == false)
{
    $moduleDir = "module";
} else
{
    $moduleDir = $module;
}

switch($module)
{
    case 'tour':
        autocompleteTour($search);
        break;
}



function autocompleteTour($search)
{
    global $dbsql,$language;
    
    header("Content-Type: text/plain");
    
    $search     = trim($search);
    $search_url = Trim_Url($search);
    
    $sql_select="select iId,cName from tblsettour where (cUrlString like '$search_url%' or cName like '$search%')
			and cLanguage='$language' order by cUrlString limit 10";
	$rs =  $dbsql->query($sql_select);
	while($result=$dbsql->fetch_array($rs))
	{
		echo $result['cName']."\n";
	}
	
	$dbsql->close();
	exit();
}